package cn.wolfcode.service.impl;

import cn.wolfcode.domain.Book;
import cn.wolfcode.mapper.BookMapper;
import cn.wolfcode.query.QueryObject;
import cn.wolfcode.service.BookService;
import cn.wolfcode.utils.PageResult;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.function.Function;

@Service
public class BookServiceImpl extends ServiceImpl<BookMapper, Book> implements BookService {

    @Autowired
    private BookMapper bookMapper;

    @Override
    public PageInfo<Book> selectAll(QueryObject queryObject) {
        PageHelper.startPage(queryObject.getCurrentPage(),queryObject.getPageSize());
        List<Book> books = bookMapper.selectList(null);
        System.out.println("--books--"+books);
        return new PageInfo<>(books);
    }
}
